package com.begonzales.locker.dto;

import com.begonzales.locker.dto.DTOAnnotation;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: begonza
 * Date: 9/19/11
 * Time: 10:58 PM
 * To change this template use File | Settings | File Templates.
 */
public class HeaderDTO {

    private String headerName = "";
    private List<DTOAnnotation> annotations = null;

    public String annotationToString()
    {
        if ( null == annotations )
        {
            return "" ;
        }
        String retval = "";
        for(DTOAnnotation item : annotations)
        {
              retval = retval + item.toString();
        }
        retval = retval.replace("\t","");
        return retval;
    }

    public DTOAnnotation addAnnotation(String annotationName, String name, String value)
    {
        DTOAnnotation itm = new DTOAnnotation(annotationName, name, value);
        this.getAnnotations().add( itm );
        return itm;
    }

    public List<DTOAnnotation> getAnnotations() {
        if ( null == annotations)
        {
            annotations = new ArrayList<DTOAnnotation>();
        }
        return annotations;
    }

    public String getHeaderName() {
        return headerName;
    }

    public void setHeaderName(String headerName) {
        this.headerName = headerName;
    }
}
